package com.office.anywher.address;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.wenxy.common.IConst;

public class AddressUtil {
	public static List<HashMap<String, Object>> queryAddress(List<HashMap<String, Object>> datas,int type,String searchKey){
		List<HashMap<String, Object>> rtnList = new ArrayList<HashMap<String, Object>>();
		for(HashMap<String, Object> map : datas){
			String title = null;
			if(type == IConst.Http.Address.PUBLIC.TYPE){
				title = (map!=null && map.containsKey(IConst.Http.Address.PUBLIC.OUT.ORGAN_NAME))?map.get(IConst.Http.Address.PUBLIC.OUT.ORGAN_NAME)+"":null;

			}else if(type == IConst.Http.Address.PERSONAL.TYPE){
				title = (map!=null && map.containsKey(IConst.Http.Address.PERSONAL.OUT.SUB_NAME))?map.get(IConst.Http.Address.PERSONAL.OUT.SUB_NAME)+"":null;

			}
			if(searchKey==null || searchKey.trim().length()<=0)
				rtnList.add(map);
			else if(title!=null && title.contains(searchKey))
				rtnList.add(map);
		}
		return rtnList;
	}
}
